package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import io.User.Gender;

public class ExternalizableDemo {

	public static void main(String[] args) throws Exception {
		
		ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream("userexternal.pfzhang"));
		UserExternal user = new UserExternal("哈哈农",40,99999999,io.UserExternal.Gender.Male);
		objectOutputStream.writeObject(user);

		ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream("userexternal.pfzhang"));
		UserExternal user1 = (UserExternal)inputStream.readObject();
		 System.out.println(user1.Name + ";" + user1.Age + "," + user.Deposit + "," + user.getGender());
		 
	}

}
